<template>
  <my-select v-model="data" value-key="equipmentId" clearable filterable multiple v-bind="$attrs">
    <el-option
      v-for="item in dataList"
      :key="item.equipmentId"
      :label="item.equipmentName+'('+item.equipmentNumber+')'"
      :value="item">
    </el-option>
  </my-select>
</template>

<script>
  import {
  	equipmentListAll,
  } from "@/api/equipment/equipment";
  export default{
    name:'instrumentSelect',
    props:{
      value:{
        type:Array,
        required:true
      }
    },
    data(){
      return{
        dataList:[],
      }
    },
    computed:{
      data:{
        get(){
          return this.value ? this.value: null
        },
        set(value){
          this.$emit('input',value)
          this.$emit('change',value)
        }
      }
    },
    created(){
      this.init()
    },
    methods:{
      init(){
        this.getList()
      },
      getList() {
        equipmentListAll().then(response => {
          this.dataList = response.data
        });
      },
    }
  }
</script>

<style>
</style>
